package com.tsd.jxc.goods.entity;

import cn.hutool.core.bean.BeanUtil;
import com.tsd.core.utils.FieldUtils;
import com.tsd.core.utils.HlpUtils;
import com.tsd.utils.AutoInjectUtils;
import io.swagger.annotations.ApiModel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 商品基本信息表扩展
 *
 * @author Hillpool
 * @date 2022/07/29 15:02:35
 */
@ApiModel(description = "商品基本信息表扩展")
public class JxcGoodsExt extends JxcGoods implements Serializable {
    /**
     * 包装单位与价格列表
     */
    private List<JxcGoodsPriceExt> price_list;
    private String category_name;

    /**
     * 行业
     */
    private String industry_config;

    private List<String> category_list;

    private Integer import_index;

    public String getCategory_name() {
        return category_name;
    }

    public void setCategory_name(String category_name) {
        this.category_name = category_name;
    }

    public String getIndustry_config() {
        return industry_config;
    }

    public void setIndustry_config(String industry_config) {
        this.industry_config = industry_config;
    }

    public List<String> getCategory_list() {
        return category_list;
    }

    public void setCategory_list(List<String> category_list) {
        this.category_list = category_list;
    }

    public List<JxcGoodsPriceExt> getPrice_list() {
        return price_list;
    }

    public void setPrice_list(List<JxcGoodsPriceExt> price_list) {
        this.price_list = price_list;
    }

    public Integer getImport_index() {
        return import_index;
    }

    public void setImport_index(Integer import_index) {
        this.import_index = import_index;
    }

    public JxcGoodsExt copy() {
        JxcGoodsExt newGoodsExt = BeanUtil.copyProperties(this, JxcGoodsExt.class);
        List<JxcGoodsPriceExt> priceList = new ArrayList<>();
        if (!HlpUtils.isEmptyList(this.getPrice_list())) {
            for (JxcGoodsPriceExt priceExt : this.getPrice_list()) {
                JxcGoodsPriceExt newPriceExt = BeanUtil.copyProperties(priceExt, JxcGoodsPriceExt.class);
                AutoInjectUtils.clearBaseData(newPriceExt);
                priceList.add(newPriceExt);
            }
        }
        AutoInjectUtils.clearBaseData(newGoodsExt);
        newGoodsExt.setPrice_list(priceList);
        return newGoodsExt;
    }
}
